package day11homework;
/**
 * 
 * @author LLLLogan
 *
 */
public class Zy02 {
	
	public static void main(String[] args) {
		String str = "abkkcdkkefkkskk";
		String key = "kk";
		System.out.println(getSubCount(str, key));
	}
	
	public static int getSubCount(String str,String key) {
		int count = 0;
		int num = 0;
		while(num <= str.length() - 1 ) {
			num = str.indexOf(key,num);
			//如果str还有key
			if(str.indexOf(key,num) != -1) {
				num += key.length();
				count++;
			}
			else{
				break;
			}
		}
		return count;
	}
}
